<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客管理-新增标签</title>
    <link rel="stylesheet" href="../../static/lib/semantic-ui/semantic.min.css">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css">
    <link rel="stylesheet" href="../../static/css/style.css">
</head>
<body>
<!--导航start-->
<nav th:replace="admin/_fragments :: menu(3)" class="ui attached inverted segment padded-tb-mini shadow-small">
    <div class="ui container">
        <div class="ui menu inverted secondary stackable">
            <h2 class="ui header teal item">管理后台</h2>
            <a href="#" class="item mobile-hide m-item"><i class="small icon home"></i>博客</a>
            <a href="#" class="item mobile-hide m-item"><i class="small icon idea"></i>分类</a>
            <a href="#" class="active item mobile-hide m-item"><i class="small icon tags"></i>标签</a>
            <div class="right menu m-item mobile-hide">
                <div class="ui item dropdown">
                    <div class="text">
                        <img src="https://picsum.photos/id/1005/100/100" class="ui avatar image">
                        多俊睿
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui button icon black button-right-top mobile-show menu toggle">
        <i class="icon sidebar"></i>
    </a>
</nav>
<!--导航end-->

<!--二级导航条start-->
<div class="ui menu attached pointing">
    <div class="ui container">
        <div class="right menu">
            <a href="#" class="active item" th:href="@{/admin/tags/add}">新增</a>
            <a href="#" class="item teal" th:href="@{/admin/tags}">列表</a>
        </div>
    </div>
</div>
<!--二级导航条end-->

<!--中间内容start-->
<div class="padded-tb-large container-small">
    <div class="ui container">
        <form action="#" method="post" class="ui form" th:object="${tag}"
              th:action="*{id}==null ? @{/admin/tags} : @{/admin/tags/{id}(id=*{id})}">
            <input type="hidden" name="id" th:value="*{id}">
            <div class="required field">
                <div class="ui left teal labeled input">
                    <label class="ui teal basic label">名称</label>
                    <input type="text" name="name" placeholder="标签的名称..." th:value="*{name}">
                </div>
            </div>

            <!--表单验证错误提示div-->
            <div class="ui error message"></div>

            <!--以下div静态页面不会显示，但模板引擎会进行识别显示-->

            <!--/*/
            <div class="ui negative message" th:if="${#fields.hasErrors('name')}">
                <i class="close icon"></i>
                <div class="header">验证失败：</div>
                <p th:errors="*{name}">提交信息不符合规则</p>
            </div>
            /*/-->

            <div class="ui container right aligned">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button class="ui orange submit button">提交</button>
            </div>

        </form>
    </div>
</div>
<!--中间内容end-->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--底部start-->
<footer th:replace="admin/_fragments :: footer" class="ui segment inverted vertical padded-tb-massive">
    <div class="ui container center aligned">
        <div class="ui grid inverted divided stackable">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../../static/images/github.png" class="ui image rounded" alt="Github二维码"
                             style="width: 110px">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header text-lined text-spaced text-thin">最新博客</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">用户故事（User Story）</a>
                    <a href="#" class="item">关于刻意练习的清单</a>
                    <a href="#" class="item">失败要趁早</a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header text-lined text-spaced text-thin">联系我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">Email：duojunrui@163.com</a>
                    <a href="#" class="item">QQ: 1358528202</a>
                    <a href="#" class="item">WeChat: djr1119</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header text-lined text-spaced text-thin">Blog</h4>
                <p class="text-lined text-spaced text-thin opacity-mini">
                    这是我的个人博客，会分享关于编程、写作、思考相关的任何内容，希望可以给来到这儿的人有所帮助...</p>
            </div>
        </div>
        <div class="ui inverted section divider"></div>
        <p class="text-lined text-spaced text-thin opacity-tiny">Copyright © 2019-2020 Duojunrui Designed by
            Duojunrui</p>
    </div>
</footer>
<!--底部end-->

<th:block th:replace="admin/_fragments :: script">
    <script src="../../static/lib/jquery/jquery-3.4.1.min.js"></script>
    <script src="../../static/lib/semantic-ui/semantic.min.js"></script>
</th:block>

<script>

    /*---手机导航栏隐藏和展开----*/
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('mobile-hide');
    });

    $('.ui.dropdown').dropdown();

    /*表单验证*/
    $(".ui.form").form({
        fields: {
            title: {
                identifier: "name",
                rules: [{
                    type: "empty",
                    prompt: "请输入标签名称！"
                }]
            }
        }
    });

    // 消息提示关闭初始化
    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });
</script>
</body>
</html>